from collections import defaultdict
from queue import PriorityQueue

mp = defaultdict(str)

s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"


class Node(object):
    def __init__(self, value=None):
        self._value = value
        self._left = None
        self._right = None

    def __lt__(self, other):
        return self._value < other._value


n = int(input())
m = list(map(int, input().split()))

q = PriorityQueue()

for i, a in enumerate(m):
    q.put((a, Node(s[i])))

while q.qsize() > 1:
    x = q.get()
    y = q.get()
    c = Node(x[1]._value + y[1]._value)  # 分离
    c._left = x[1]
    c._right = y[1]
    q.put((x[0] + y[0], c))

    for it in c._left._value:
        mp[it] += "0"
    for it in c._right._value:
        mp[it] += "1"

for i in range(0, n):
    print(mp[s[i]][::-1])
